import * as Cesium from "cesium";

export const getDistance = (p1, p2) => {
  let point1;
  let point2;
  try {
    point1 = Cesium.Cartesian3.fromDegrees(p1[0], p1[1], p1[2]);
    point2 = Cesium.Cartesian3.fromDegrees(p2[0], p2[1], p2[2]);
  } catch (error) {
    console.error(error);
    return
  }
  const distance = Cesium.Cartesian3.distance(point1, point2);
  return distance;
};
